#!/usr/bin/env python
#coding=utf-8

from pyamf.remoting.gateway.django import DjangoGateway
import UserValidator
import Statistics

def sayHello(request, name):
    return 'Hello ' + name

def userValidate(request, queryString, app_secret):
    return UserValidator.validate(queryString, app_secret)

def getUserRecord(request, userID, filePath = 'd:/Statistics.xml'):
    return Statistics.getUserRecord(userID, filePath)

def setUserRecord(request, userID, isWin, filePath = 'd:/Statistics.xml'):
    return Statistics.setUserRecord(userID, isWin, filePath)

usersGateway = DjangoGateway({
    'amfp.sayHello':sayHello,
    'amfp.userValidate':userValidate,
    'amfp.getUserRecord':getUserRecord,
    'amfp.setUserRecord':setUserRecord
})